/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.entity.fixedexpense;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.modules.base.entity.customer.Customer;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * 固定费用项目Entity
 * @author Kilo
 * @version 2021-03-02
 */
@Table(name="t_customer_price", alias="a", columns={
		@Column(name="customer_price_id", attrName="customerPriceId", label="客户销售价格ID", isPK=true),
		@Column(name="customer_id", attrName="customerId", label="客户"),
		@Column(name="price", attrName="price", label="销售价格"),
		@Column(name="ratio", attrName="ratio", label="费用比例"),
		@Column(name="fixed_expense_id", attrName="fixedExpenseId.fixedExpenseId", label="固定费用项目ID"),
	}, joinTable={
		@JoinTable(type=Type.LEFT_JOIN, entity= Customer.class, attrName="customer", alias="u11",
				on="u11.customer_id = a.customer_id", columns={
				@Column(name="customer_id", label="客户编码", isPK=true),
				@Column(name="customer_name", label="客户名称", isQuery=false),
		}),
	},orderBy="a.customer_price_id ASC"
)
public class CustomerPrice extends DataEntity<CustomerPrice> {
	
	private static final long serialVersionUID = 1L;
	private String customerPriceId;		// 客户销售价格ID
	private String customerId;		// 客户
	private Double price;		// 销售价格
	private String ratio;		// 费用比例
	private FixedExpense fixedExpenseId;		// 固定费用项目ID 父类
	private Customer customer;

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public CustomerPrice() {
		this(null);
	}


	public CustomerPrice(FixedExpense fixedExpenseId){
		this.fixedExpenseId = fixedExpenseId;
	}
	
	public String getCustomerPriceId() {
		return customerPriceId;
	}

	public void setCustomerPriceId(String customerPriceId) {
		this.customerPriceId = customerPriceId;
	}
	
	@NotBlank(message="客户不能为空")
	@Length(min=0, max=64, message="客户长度不能超过 64 个字符")
	public String getCustomerId() {
		return customerId;
	}

	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}
	
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}
	
	@Length(min=0, max=10, message="费用比例长度不能超过 10 个字符")
	public String getRatio() {
		return ratio;
	}

	public void setRatio(String ratio) {
		this.ratio = ratio;
	}
	
	public FixedExpense getFixedExpenseId() {
		return fixedExpenseId;
	}

	public void setFixedExpenseId(FixedExpense fixedExpenseId) {
		this.fixedExpenseId = fixedExpenseId;
	}
	
}